﻿Imports Control_Vuelos_BL

Public Class frmConsultarManifiestoCerrado
    Inherits frmBaseMantenimiento

    ReadOnly oC_Manifiesto As New ManifiestoBL()

    Private Sub frmConsultarManifiestoCerrado_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddHandler ConsultarManifiestoCerrado1.GridView1.FocusedRowChanged, AddressOf prl_GridView1
        Try
            ConsultarManifiestoCerrado1.GridControl1.DataSource = oC_Manifiesto.pr_GetManifiesto("0")
        Catch ex As Exception
            Windows.Forms.MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub prl_GridView1()
        If ConsultarManifiestoCerrado1.GridView1.RowCount > 0 Then
            prl_FocusedFila()
        End If
    End Sub

    Dim mCodMan As String = ""
    Private Sub prl_FocusedFila()
        Dim Rows As New ArrayList()
        Rows.Add(ConsultarManifiestoCerrado1.GridView1.GetDataRow(ConsultarManifiestoCerrado1.GridView1.GetSelectedRows()(0)))
        Dim Row As DataRow = CType(Rows(0), DataRow)
        If Not Row Is Nothing Then
            mCodMan = Row("CodViaje").ToString()
            prl_MostrarDetalleManifiesto(mCodMan)
        End If
    End Sub

    Private Sub prl_MostrarDetalleManifiesto(ByVal mCodManifiesto As String)
        Try
            ConsultarManifiestoCerrado1.GridControl2.DataSource = oC_Manifiesto.pr_GetDetalleManifiesto(mCodManifiesto)
        Catch ex As Exception
            Windows.Forms.MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class